﻿//--------------------------------------------------------------------------
// <copyright file="Validates.cs" company="Microsoft">
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
// <summary>Validates</summary>
//--------------------------------------------------------------------------
namespace MS.Msn.MediaSolutions.Common
{
    using System;
    using System.Collections.Generic;
    using System.Text;

    /// <summary>
    /// Validates
    /// </summary>
    public static class Validates
    {
        /// <summary>
        /// CheckByRefNull
        /// </summary>
        /// <param name="refParam">param name</param>
        /// <param name="parName">is raise exception</param>
        /// <returns>is null or not</returns>
        public static bool CheckByRefNotNull(object refParam, string parName)
        {
            bool rtVal = (refParam == null) || object.Equals(refParam, null);
            if (rtVal)
            {
                throw new ArgumentNullException(Apps.GetArgNullExString(parName));
            }
            return !rtVal;
        }

        /// <summary>
        /// CheckByRefNull
        /// </summary>
        /// <param name="refParam">param name</param>
        /// <returns>is null or not</returns>
        public static bool CheckByRefNotNull(object refParam)
        {
            return CheckByRefNotNull(refParam, string.Empty);
        }
    }
}
